/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entityBeans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author allankv
 */
@Entity
@Table(name = "locality")
@NamedQueries({
    @NamedQuery(name = "Locality.findAll", query = "SELECT l FROM Locality l"),
    @NamedQuery(name = "Locality.findByIdlocality", query = "SELECT l FROM Locality l WHERE l.idlocality = :idlocality"),
    @NamedQuery(name = "Locality.findByLocality", query = "SELECT l FROM Locality l WHERE l.locality = :locality")})
public class Locality implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idlocality")
    private Integer idlocality;
    @Basic(optional = false)
    @Column(name = "locality")
    private String locality;
    @OneToMany(mappedBy = "locality", fetch = FetchType.LAZY)
    private List<Localityelement> localityelementList;

    public Locality() {
    }

    public Locality(Integer idlocality) {
        this.idlocality = idlocality;
    }

    public Locality(Integer idlocality, String locality) {
        this.idlocality = idlocality;
        this.locality = locality;
    }

    public Integer getIdlocality() {
        return idlocality;
    }

    public void setIdlocality(Integer idlocality) {
        this.idlocality = idlocality;
    }

    public String getLocality() {
        return locality;
    }

    public void setLocality(String locality) {
        this.locality = locality;
    }

    public List<Localityelement> getLocalityelementList() {
        return localityelementList;
    }

    public void setLocalityelementList(List<Localityelement> localityelementList) {
        this.localityelementList = localityelementList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idlocality != null ? idlocality.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Locality)) {
            return false;
        }
        Locality other = (Locality) object;
        if ((this.idlocality == null && other.idlocality != null) || (this.idlocality != null && !this.idlocality.equals(other.idlocality))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entityBeans.Locality[idlocality=" + idlocality + "]";
    }

}
